package com.r_z.mapper;

import org.apache.ibatis.annotations.*;
import com.r_z.entity.FiscalExpenditure;

import java.util.List;
import java.util.Map;

/**
 * 财务支出
 * @author :yimeng
 * @date :2023/5/30  8:52
 * @description:some description
 */
@Mapper
public interface FiscalExpenditureMapper {
    /**
     * 根据主键ID查询财务信息
     * @param fExpenditureId
     * @return
     */
    @Select("select * from fiscalExpenditure where fExpenditureId = #{fExpenditureId}")
    List<FiscalExpenditure> selectAllFiscalExpenditure(String fExpenditureId);

    /**
     * 根据条件分页查询
     * @param map
     * @return
     */
    @Select("select * from fiscalExpenditure where 1=1 ${strWhere} limit #{page},#{limit}")
    List<FiscalExpenditure> LimitFiscalExpenditure(Map map);

    /**
     * 根据条件查询总行数
     * @param map
     * @return
     */
    @Select("select count(*) from fiscalExpenditure where 1=1 ${strWhere}")
    int countFiscalExpenditure(Map map);

    /**
     * 添加财务支出信息
     * @param fiscalExpenditure
     * @return
     */
    @Insert("INSERT INTO fiscalExpenditure VALUES(#{fExpenditureId},#{purchaseId},#{money},#{data_time},#{audit_state},#{type},#{describes})")
    int insertFiscalExpenditure(FiscalExpenditure fiscalExpenditure);

    /**
     * 根据主键ID进行删除财务支出信息
     * @param fExpenditureId
     * @return
     */
    @Delete("delete from FiscalExpenditure where fExpenditureId = #{fExpenditureId}")
    int deleteFiscalExpenditure(String fExpenditureId);

    /**
     * 批量删除
     * @param fExpenditureId
     * @return
     */
    int deleteFiscalExpenditureById(List fExpenditureId);

    /**
     * 根据主键ID进行修改财务支出信息
     * @param fiscalExpenditure
     * @return
     */
    @Update("update FiscalExpenditure set purchaseId=#{purchaseId},money=#{money},data_time=#{data_time},audit_state=#{audit_state},type=#{type},describes = #{describes} where fExpenditureId = #{fExpenditureId}")
    int updateFiscalExpenditure(FiscalExpenditure fiscalExpenditure);

}
